<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8"/>
    <title>添加</title>
    <link href="__STATIC__/component/pear/css/pear.css" rel="stylesheet"/>
</head>
<body class="childrenBody {:dialog_css()}" style="padding-top:0;">

<form class="layui-form" action="{:url('add')}" method="post">

	<div class="layui-tab layui-tab-brief" style="margin-top:0;">
		<ul class="layui-tab-title">
			<li class="layui-this">基本</li>
			<li>内容</li>
			<li>SEO</li>
		</ul>
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">
				<div class="layui-form-item">
					<label class="layui-form-label layui-form-item-required">父栏目</label>
					<div class="layui-input-block">
						{:form_select('pid', widget('cate_tree')->get(), 1)}
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-form-item-required">标题</label>
					<div class="layui-input-block">
						<input type="text" name="title" value=""  placeholder="请输入标题" class="layui-input"/>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-form-item-required">标识</label>
					<div class="layui-input-block">
						<input type="text" name="sign" value=""  placeholder="请输入标识" class="layui-input"/>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-form-item-required">父栏目</label>
					<div class="layui-input-block">
						<input type="hidden" name="is_parent" value="0">
						<input type="checkbox" name="is_parent" value="1" lay-skin="switch" lay-text="是|否" />
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-form-item-required">类型</label>
					<div class="layui-input-block">{:form_radio('type_id', '1=单页|列表|外链', 1)}</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">页面链接</label>
					<div class="layui-input-block">
						<input type="text" name="href" value="#" placeholder="请输入链接" class="layui-input"/>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">打开方式</label>
					<div class="layui-input-block">
						{:form_select('target', '_self=_self|_blank=_blank', '_self')}
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">所属模型</label>
					<div class="layui-input-block">
						{:form_select('model_id', widget('model_select')->get(), 0)}
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">排序</label>
					<div class="layui-input-block">
						<input type="number" name="sort" value="100" min="0" step="10" lay-affix="number" placeholder="数字排序值" class="layui-input">
					</div>
				</div>
			</div>
			<div class="layui-tab-item">
				<div class="layui-form-item">
					<label class="layui-form-label">HTML</label>
					<div class="layui-input-block"><textarea name="html_code" id="editor-html" placeholder="请输入HTML代码" class="layui-textarea"></textarea></div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">封面</label>
					<div class="layui-input-block"><input type="hidden" id="thumb" name="thumb" value="" /><div class="upload-image layui-upload-drag aphp-upload" id="ID-upload-image-thumb" data-url="{:url('api/upload')}?api=thumb" data-accept="image" data-field="thumb"><img id="thumb-preview" src="" style="display:none;" width="90" height="60" alt="thumb">上传封面<span id="thumb-remove" class="remove-pic">删除</span></div><button type="button" class="layui-btn layui-btn-sm" id="thumb-selected" data-url="{:url('attach/selected')}?type=image&dialog=1">图库选择</button></div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">摘要</label>
					<div class="layui-input-block"><textarea name="summary" id="editor-summary" placeholder="请输入摘要" class="layui-textarea"></textarea></div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">内容</label>
					<div class="layui-input-block"><textarea name="content" id="editor-content" class="layui-textarea editor-tinymce" placeholder="请输入内容"></textarea></div>
				</div>
			</div>
			<div class="layui-tab-item">
				<div class="layui-form-item">
					<label class="layui-form-label">SEO标题</label>
					<div class="layui-input-block"><input type="text" name="seo_title" value=""  placeholder="请输入SEO标题" class="layui-input"/></div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">SEO关键字</label>
					<div class="layui-input-block">
						<textarea name="seo_kw" placeholder="请输入SEO关键字" class="layui-textarea"></textarea>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">SEO描述</label>
					<div class="layui-input-block">
						<textarea name="seo_desc" placeholder="请输入SEO描述" class="layui-textarea"></textarea>
					</div>
				</div>
			</div>

		</div>
	</div>

    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="save">
                <i class="layui-icon layui-icon-ok"></i>
                添加
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>

<script src="__STATIC__/component/layui/layui.js"></script>
<script src="__STATIC__/component/pear/pear.js"></script>
<script>
    layui.use(['aphpForm', 'aphp', 'form'], function () {
        var aphpForm = layui.aphpForm,
            aphp = layui.aphp,
            form = layui.form;

        aphpForm.bindEvent('form.layui-form'); // 渲染表单

        form.on('submit(save)', function (data) {
            aphp.request.postForm(data, 0, function () {
                parent.layer.close(parent.layer.getFrameIndex(window.name));
                parent.layui.table.reload('currentTable');
            });
            return false;
        });
    })
</script>
</body>
</html>